package com.mright.step01.xml.impl;

import com.alibaba.dubbo.rpc.RpcContext;
import com.mright.step01.api.EchoApi;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Echo服务实现类
 *
 * @author zhaochuanzhen
 * @since 2022/2/10 11:07 下午
 */
public class EchoApiImpl implements EchoApi {

    public String echo(String message) {
        String now = new SimpleDateFormat("HH:mm:ss").format(new Date());
        System.out.println("[" + now + "] Hello " + message
                + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
        return message;
    }
}
